use std::sync::Arc;
use std::thread;
use std::thread::sleep;
use std::time::Duration;

fn main() {
    let v = vec![1,2,3,4,5];
    let handle = thread::spawn(move || {
        sleep(Duration::from_millis(1));
        println!("v: {:?}", v);
    });
    handle.join().unwrap();

    let vec = Arc::new(vec![1, 2, 3, 4, 5, 6]);
    let vec_v = Arc::clone(&vec);
    let handle = thread::spawn(move || {
        sleep(Duration::from_millis(1));
        println!("vec: {:?}", vec);
    });
    handle.join().unwrap();
    println!("vec_v = {:?}", vec_v);
    println!("Hello, world!");
}
